package presentacion;

import datos.Bloque;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Image;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.JToggleButton;
import javax.swing.ScrollPaneConstants;
import javax.swing.border.LineBorder;
import javax.swing.filechooser.FileNameExtensionFilter;
import logica.ControladorHerramientas;
import logica.ControladorMapa;
import logica.ControladorUsuario;
import logica.ElementoMapa;

public class VentanaMapBuilder extends javax.swing.JFrame {

    private ControladorMapa cm;
    private ControladorUsuario cu;
    private ControladorHerramientas ce;
    private List<ElementoMapa> elementosMapa = new ArrayList<>();
    private Image btnSelectBloque_Icon;
    private Bloque bloqueSeleccionado;
    String nombreMapa;
    FileNameExtensionFilter filtro;

    public VentanaMapBuilder() {
        //this.setUndecorated(true);
        //this.setExtendedState(MAXIMIZED_BOTH);
        initComponents();
        initMyComponents();
        cm = new ControladorMapa(this);
        ce = new ControladorHerramientas(this);
        nmapa_txtAutor.setEditable(false);
        nmapa_txtTamBloques.setEditable(false);
        nombreMapa = "";
    }

    private void initMyComponents() {
        scroll_panelEditor.setViewportView(panel_editorMapa);
        panel_editorMapa.validate();
        scroll_panelEditor.validate();
        panel_ImgBloque.setLayout(new GridLayout(1, 1));
        scroll_SelectBloque.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        scroll_SelectBloque.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
        dialogoCargando.setLocationRelativeTo(this);
        filtro = new FileNameExtensionFilter("Mapa de MapBuilder", "map");
        dialogoGuardarArchivo.setFileFilter(filtro);
        ActivarPropiedades();
    }

    private void ActivarPropiedades() {
        txtNombreMapa.setEnabled(false);
        props_txtCodigo.setEditable(false);
        props_txtNombre.setEditable(false);
        props_txtCateg.setEditable(false);
        props_txtDesc.setEditable(false);
        props_txtX.setEditable(false);
        props_txtY.setEditable(false);
        selecB_txtNombre.setEditable(false);
        selecB_txtCateg.setEditable(false);
        selecB_txtDesc.setEditable(false);
    }

    private void ActivarHerramientas() {
        if (bloque_btnSelec.getIcon() == null) {
            herram_btnLapiz.setEnabled(false);
        } else {
            herram_btnLapiz.setEnabled(true);
        }
        txtNombreMapa.setText(nmapa_txtNombre.getText());
        txtNombreMapa.setEnabled(true);
        herram_btnPuntero.setEnabled(true);
        herram_btnPuntero.setSelected(true);
        bloque_btnSelec.setEnabled(true);
        mItemGuardar.setEnabled(true);
        bloque_btnSelec.setBorder(new LineBorder(Color.black, 1));
    }

    private void LimpiarComponentes() {
        panel_editorMapa.setEnabled(false);
        txtNombreMapa.setText("");
        txtNombreMapa.setEnabled(false);
        props_txtCodigo.setText("");
        props_txtNombre.setText("");
        props_txtCateg.setText("");
        props_txtDesc.setText("");
        props_txtX.setText("");
        props_txtY.setText("");
        props_ImgBloque.setIcon(null);
        herram_btnLapiz.setEnabled(false);
        herram_btnPuntero.setEnabled(false);
        bloque_btnSelec.setEnabled(false);
        panel_editorMapa.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        dialogoNuevoMapa = new javax.swing.JDialog();
        panel_nuevoMapa = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        nmapa_txtAutor = new javax.swing.JTextField();
        nmapa_btnIdent = new javax.swing.JButton();
        jLabel6 = new javax.swing.JLabel();
        nmapa_txtNombre = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        nmapa_txtDesc = new javax.swing.JTextArea();
        jLabel9 = new javax.swing.JLabel();
        nmapa_txtTamBloques = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        nmapa_txtColumnas = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        nmapa_txtFilas = new javax.swing.JTextField();
        nmapa_btnCancelar = new javax.swing.JButton();
        nmapa_btnAceptar = new javax.swing.JButton();
        dialogoSelecBloque = new javax.swing.JDialog();
        jLabel13 = new javax.swing.JLabel();
        selecB_btnSelec = new javax.swing.JButton();
        selecB_btnCancelar = new javax.swing.JButton();
        scroll_SelectBloque = new javax.swing.JScrollPane();
        panelSelecBloque = new javax.swing.JPanel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        selecB_txtDesc = new javax.swing.JTextArea();
        selecB_txtCateg = new javax.swing.JTextField();
        selecB_txtNombre = new javax.swing.JTextField();
        panel_ImgSelecBloque = new javax.swing.JPanel();
        selecB_ImgBloque = new javax.swing.JLabel();
        dialogoCargando = new javax.swing.JDialog();
        labelCargando = new javax.swing.JLabel();
        dialogoGuardarArchivo = new javax.swing.JFileChooser();
        dialogoIdentificarse = new javax.swing.JDialog();
        jLabel17 = new javax.swing.JLabel();
        txtUsuario = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        dialogoBtnIdentificarse = new javax.swing.JButton();
        txtClave = new javax.swing.JPasswordField();
        panelProps = new javax.swing.JPanel();
        panel_ImgBloque = new javax.swing.JPanel();
        props_ImgBloque = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        props_txtDesc = new javax.swing.JTextArea();
        props_txtNombre = new javax.swing.JTextField();
        props_txtCodigo = new javax.swing.JTextField();
        props_txtCateg = new javax.swing.JTextField();
        props_btnSolido = new javax.swing.JToggleButton();
        props_txtX = new javax.swing.JTextField();
        props_txtY = new javax.swing.JTextField();
        props_btnCambiar = new javax.swing.JButton();
        lblCodigo = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        lblCodigo1 = new javax.swing.JLabel();
        lblCodigo2 = new javax.swing.JLabel();
        panelEstado = new javax.swing.JPanel();
        panelCabezera = new javax.swing.JPanel();
        txtNombreMapa = new javax.swing.JTextField();
        panelHerram = new javax.swing.JPanel();
        herram_btnPuntero = new javax.swing.JToggleButton();
        herram_btnLapiz = new javax.swing.JToggleButton();
        scroll_panelEditor = new javax.swing.JScrollPane();
        panel_editorMapa = new javax.swing.JLayeredPane()
        ;
        panelBloque = new javax.swing.JPanel();
        bloque_btnSelec = new javax.swing.JButton();
        barramenu = new javax.swing.JMenuBar();
        menuArchivo = new javax.swing.JMenu();
        mItemNuevo = new javax.swing.JMenuItem();
        mItemAbrir = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JPopupMenu.Separator();
        mItemGuardar = new javax.swing.JMenuItem();
        jSeparator3 = new javax.swing.JPopupMenu.Separator();
        mItemCerrar = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        mItemSalir = new javax.swing.JMenuItem();

        dialogoNuevoMapa.setAlwaysOnTop(true);
        dialogoNuevoMapa.setMinimumSize(new java.awt.Dimension(350, 400));
        dialogoNuevoMapa.setModal(true);
        dialogoNuevoMapa.setResizable(false);
        dialogoNuevoMapa.setType(java.awt.Window.Type.UTILITY);
        dialogoNuevoMapa.pack();
        dialogoNuevoMapa.setLocationRelativeTo(this);

        jLabel7.setFont(new java.awt.Font("Calibri", 3, 24)); // NOI18N
        jLabel7.setText("Crear nuevo Mapa");

        jLabel5.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        jLabel5.setText("Autor:");

        nmapa_txtAutor.setColumns(20);
        nmapa_txtAutor.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        nmapa_txtAutor.setText("Anónimo");

        nmapa_btnIdent.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        nmapa_btnIdent.setText("Identificarse");
        nmapa_btnIdent.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                nmapa_btnIdentActionPerformed(evt);
            }
        });

        jLabel6.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        jLabel6.setText("Nombre Mapa:");

        nmapa_txtNombre.setColumns(20);
        nmapa_txtNombre.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        nmapa_txtNombre.setText("Nuevo Mapa");

        jLabel8.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        jLabel8.setText("Descripción Mapa:");

        nmapa_txtDesc.setColumns(20);
        nmapa_txtDesc.setFont(new java.awt.Font("Calibri", 2, 12)); // NOI18N
        nmapa_txtDesc.setRows(5);
        nmapa_txtDesc.setText("Sin descripción");
        jScrollPane1.setViewportView(nmapa_txtDesc);

        jLabel9.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        jLabel9.setText("Tamaño Bloques:");

        nmapa_txtTamBloques.setColumns(3);
        nmapa_txtTamBloques.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        nmapa_txtTamBloques.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        nmapa_txtTamBloques.setText("32");

        jLabel10.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        jLabel10.setText("pixeles");

        jLabel11.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        jLabel11.setText("Tamaño Mapa:");

        nmapa_txtColumnas.setColumns(3);
        nmapa_txtColumnas.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        nmapa_txtColumnas.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        nmapa_txtColumnas.setText("50");

        jLabel12.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        jLabel12.setText("x");

        nmapa_txtFilas.setColumns(3);
        nmapa_txtFilas.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        nmapa_txtFilas.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        nmapa_txtFilas.setText("50");

        nmapa_btnCancelar.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        nmapa_btnCancelar.setText("Cancelar");
        nmapa_btnCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                nmapa_btnCancelarActionPerformed(evt);
            }
        });

        nmapa_btnAceptar.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        nmapa_btnAceptar.setText("Aceptar");
        nmapa_btnAceptar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                nmapa_btnAceptarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panel_nuevoMapaLayout = new javax.swing.GroupLayout(panel_nuevoMapa);
        panel_nuevoMapa.setLayout(panel_nuevoMapaLayout);
        panel_nuevoMapaLayout.setHorizontalGroup(
            panel_nuevoMapaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panel_nuevoMapaLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(panel_nuevoMapaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panel_nuevoMapaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(panel_nuevoMapaLayout.createSequentialGroup()
                            .addGroup(panel_nuevoMapaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(jLabel6)
                                .addComponent(jLabel8)
                                .addComponent(jLabel9)
                                .addComponent(jLabel11))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(panel_nuevoMapaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(nmapa_txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGroup(panel_nuevoMapaLayout.createSequentialGroup()
                                    .addComponent(nmapa_txtTamBloques, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabel10))
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGroup(panel_nuevoMapaLayout.createSequentialGroup()
                                    .addComponent(nmapa_txtColumnas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabel12)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(nmapa_txtFilas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addGroup(panel_nuevoMapaLayout.createSequentialGroup()
                            .addGap(104, 104, 104)
                            .addComponent(nmapa_btnIdent))
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panel_nuevoMapaLayout.createSequentialGroup()
                            .addComponent(nmapa_btnCancelar)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(nmapa_btnAceptar)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panel_nuevoMapaLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 69, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(panel_nuevoMapaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel7)
                            .addGroup(panel_nuevoMapaLayout.createSequentialGroup()
                                .addComponent(jLabel5)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(nmapa_txtAutor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap())
        );
        panel_nuevoMapaLayout.setVerticalGroup(
            panel_nuevoMapaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panel_nuevoMapaLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel7)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(panel_nuevoMapaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(nmapa_txtAutor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(5, 5, 5)
                .addComponent(nmapa_btnIdent)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panel_nuevoMapaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(nmapa_txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panel_nuevoMapaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel8)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(7, 7, 7)
                .addGroup(panel_nuevoMapaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(nmapa_txtTamBloques, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panel_nuevoMapaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(nmapa_txtColumnas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12)
                    .addComponent(nmapa_txtFilas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(panel_nuevoMapaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(nmapa_btnAceptar)
                    .addComponent(nmapa_btnCancelar))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout dialogoNuevoMapaLayout = new javax.swing.GroupLayout(dialogoNuevoMapa.getContentPane());
        dialogoNuevoMapa.getContentPane().setLayout(dialogoNuevoMapaLayout);
        dialogoNuevoMapaLayout.setHorizontalGroup(
            dialogoNuevoMapaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(dialogoNuevoMapaLayout.createSequentialGroup()
                .addComponent(panel_nuevoMapa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        dialogoNuevoMapaLayout.setVerticalGroup(
            dialogoNuevoMapaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(dialogoNuevoMapaLayout.createSequentialGroup()
                .addComponent(panel_nuevoMapa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(72, 72, 72))
        );

        dialogoSelecBloque.setAlwaysOnTop(true);
        dialogoSelecBloque.setMinimumSize(new java.awt.Dimension(350, 460));
        dialogoSelecBloque.setModal(true);
        dialogoSelecBloque.setResizable(false);
        dialogoSelecBloque.setType(java.awt.Window.Type.POPUP);

        jLabel13.setFont(new java.awt.Font("Calibri", 3, 24)); // NOI18N
        jLabel13.setText("Seleccionar Bloque");

        selecB_btnSelec.setFont(new java.awt.Font("Calibri", 1, 12)); // NOI18N
        selecB_btnSelec.setText("Seleccionar");
        selecB_btnSelec.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                selecB_btnSelecActionPerformed(evt);
            }
        });

        selecB_btnCancelar.setFont(new java.awt.Font("Calibri", 1, 12)); // NOI18N
        selecB_btnCancelar.setText("Cancelar");
        selecB_btnCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                selecB_btnCancelarActionPerformed(evt);
            }
        });

        panelSelecBloque.setBackground(new java.awt.Color(255, 255, 255));
        panelSelecBloque.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        panelSelecBloque.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));

        javax.swing.GroupLayout panelSelecBloqueLayout = new javax.swing.GroupLayout(panelSelecBloque);
        panelSelecBloque.setLayout(panelSelecBloqueLayout);
        panelSelecBloqueLayout.setHorizontalGroup(
            panelSelecBloqueLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 94, Short.MAX_VALUE)
        );
        panelSelecBloqueLayout.setVerticalGroup(
            panelSelecBloqueLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 207, Short.MAX_VALUE)
        );

        scroll_SelectBloque.setViewportView(panelSelecBloque);

        jLabel14.setFont(new java.awt.Font("Calibri", 1, 14)); // NOI18N
        jLabel14.setText("Nombre:");

        jLabel15.setFont(new java.awt.Font("Calibri", 1, 14)); // NOI18N
        jLabel15.setText("Descripción:");

        jLabel16.setFont(new java.awt.Font("Calibri", 1, 14)); // NOI18N
        jLabel16.setText("Categoría:");

        selecB_txtDesc.setColumns(18);
        selecB_txtDesc.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        selecB_txtDesc.setLineWrap(true);
        selecB_txtDesc.setRows(7);
        selecB_txtDesc.setWrapStyleWord(true);
        jScrollPane3.setViewportView(selecB_txtDesc);

        selecB_txtCateg.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N

        selecB_txtNombre.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N

        panel_ImgSelecBloque.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        panel_ImgSelecBloque.setMinimumSize(new java.awt.Dimension(128, 128));
        panel_ImgSelecBloque.setPreferredSize(new java.awt.Dimension(128, 128));

        selecB_ImgBloque.setMinimumSize(new java.awt.Dimension(128, 128));
        selecB_ImgBloque.setPreferredSize(new java.awt.Dimension(128, 128));

        javax.swing.GroupLayout panel_ImgSelecBloqueLayout = new javax.swing.GroupLayout(panel_ImgSelecBloque);
        panel_ImgSelecBloque.setLayout(panel_ImgSelecBloqueLayout);
        panel_ImgSelecBloqueLayout.setHorizontalGroup(
            panel_ImgSelecBloqueLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panel_ImgSelecBloqueLayout.createSequentialGroup()
                .addComponent(selecB_ImgBloque, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        panel_ImgSelecBloqueLayout.setVerticalGroup(
            panel_ImgSelecBloqueLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panel_ImgSelecBloqueLayout.createSequentialGroup()
                .addComponent(selecB_ImgBloque, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout dialogoSelecBloqueLayout = new javax.swing.GroupLayout(dialogoSelecBloque.getContentPane());
        dialogoSelecBloque.getContentPane().setLayout(dialogoSelecBloqueLayout);
        dialogoSelecBloqueLayout.setHorizontalGroup(
            dialogoSelecBloqueLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(dialogoSelecBloqueLayout.createSequentialGroup()
                .addGroup(dialogoSelecBloqueLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(dialogoSelecBloqueLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(dialogoSelecBloqueLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(dialogoSelecBloqueLayout.createSequentialGroup()
                                .addGap(14, 14, 14)
                                .addGroup(dialogoSelecBloqueLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel16)
                                    .addComponent(jLabel14))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(dialogoSelecBloqueLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(selecB_txtCateg, javax.swing.GroupLayout.PREFERRED_SIZE, 221, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(selecB_txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 221, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(dialogoSelecBloqueLayout.createSequentialGroup()
                                        .addGap(15, 15, 15)
                                        .addComponent(scroll_SelectBloque, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(panel_ImgSelecBloque, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                            .addGroup(dialogoSelecBloqueLayout.createSequentialGroup()
                                .addComponent(jLabel15)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(dialogoSelecBloqueLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(dialogoSelecBloqueLayout.createSequentialGroup()
                                        .addComponent(selecB_btnCancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(selecB_btnSelec))
                                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 221, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                    .addGroup(dialogoSelecBloqueLayout.createSequentialGroup()
                        .addGap(63, 63, 63)
                        .addComponent(jLabel13)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        dialogoSelecBloqueLayout.setVerticalGroup(
            dialogoSelecBloqueLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(dialogoSelecBloqueLayout.createSequentialGroup()
                .addGap(6, 6, 6)
                .addComponent(jLabel13)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(dialogoSelecBloqueLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(scroll_SelectBloque, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(panel_ImgSelecBloque, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(dialogoSelecBloqueLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel14)
                    .addComponent(selecB_txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(dialogoSelecBloqueLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel16)
                    .addComponent(selecB_txtCateg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(dialogoSelecBloqueLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel15)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(dialogoSelecBloqueLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(selecB_btnSelec)
                    .addComponent(selecB_btnCancelar))
                .addContainerGap(56, Short.MAX_VALUE))
        );

        dialogoCargando.setMinimumSize(new java.awt.Dimension(450, 80));
        dialogoCargando.setModal(true);
        dialogoCargando.setName(""); // NOI18N
        dialogoCargando.setUndecorated(true);
        dialogoCargando.setResizable(false);
        dialogoCargando.setType(java.awt.Window.Type.POPUP);

        labelCargando.setFont(new java.awt.Font("Calibri", 1, 24)); // NOI18N
        labelCargando.setText(".");

        javax.swing.GroupLayout dialogoCargandoLayout = new javax.swing.GroupLayout(dialogoCargando.getContentPane());
        dialogoCargando.getContentPane().setLayout(dialogoCargandoLayout);
        dialogoCargandoLayout.setHorizontalGroup(
            dialogoCargandoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(dialogoCargandoLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(labelCargando)
                .addContainerGap(477, Short.MAX_VALUE))
        );
        dialogoCargandoLayout.setVerticalGroup(
            dialogoCargandoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(dialogoCargandoLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(labelCargando)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        dialogoGuardarArchivo.setAcceptAllFileFilterUsed(false);
        dialogoGuardarArchivo.setDialogType(javax.swing.JFileChooser.SAVE_DIALOG);
        dialogoGuardarArchivo.setDialogTitle("Guardar Mapa");

        dialogoIdentificarse.setAlwaysOnTop(true);
        dialogoIdentificarse.setMinimumSize(new java.awt.Dimension(305, 140));
        dialogoIdentificarse.setModal(true);
        dialogoIdentificarse.setResizable(false);
        dialogoIdentificarse.setType(java.awt.Window.Type.POPUP);
        dialogoIdentificarse.setLocationRelativeTo(null);

        jLabel17.setFont(new java.awt.Font("Calibri", 1, 14)); // NOI18N
        jLabel17.setText("Usuario:");

        txtUsuario.setColumns(16);
        txtUsuario.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        txtUsuario.setMinimumSize(new java.awt.Dimension(14, 23));

        jLabel18.setFont(new java.awt.Font("Calibri", 1, 14)); // NOI18N
        jLabel18.setText("Clave:");

        dialogoBtnIdentificarse.setFont(new java.awt.Font("Calibri", 1, 14)); // NOI18N
        dialogoBtnIdentificarse.setText("Identificarse");
        dialogoBtnIdentificarse.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                dialogoBtnIdentificarseActionPerformed(evt);
            }
        });

        txtClave.setColumns(16);
        txtClave.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N

        javax.swing.GroupLayout dialogoIdentificarseLayout = new javax.swing.GroupLayout(dialogoIdentificarse.getContentPane());
        dialogoIdentificarse.getContentPane().setLayout(dialogoIdentificarseLayout);
        dialogoIdentificarseLayout.setHorizontalGroup(
            dialogoIdentificarseLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(dialogoIdentificarseLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(dialogoIdentificarseLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(dialogoIdentificarseLayout.createSequentialGroup()
                        .addComponent(jLabel17)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(txtUsuario, javax.swing.GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE))
                    .addGroup(dialogoIdentificarseLayout.createSequentialGroup()
                        .addGap(14, 14, 14)
                        .addGroup(dialogoIdentificarseLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(dialogoBtnIdentificarse)
                            .addGroup(dialogoIdentificarseLayout.createSequentialGroup()
                                .addComponent(jLabel18)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(txtClave)))))
                .addContainerGap())
        );
        dialogoIdentificarseLayout.setVerticalGroup(
            dialogoIdentificarseLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(dialogoIdentificarseLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(dialogoIdentificarseLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel17)
                    .addComponent(txtUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(dialogoIdentificarseLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(txtClave, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(dialogoBtnIdentificarse)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("MapBuilder");

        panelProps.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Propiedades de bloque seleccionado", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Calibri", 1, 14), new java.awt.Color(0, 0, 0))); // NOI18N

        panel_ImgBloque.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        panel_ImgBloque.setPreferredSize(new java.awt.Dimension(128, 128));

        javax.swing.GroupLayout panel_ImgBloqueLayout = new javax.swing.GroupLayout(panel_ImgBloque);
        panel_ImgBloque.setLayout(panel_ImgBloqueLayout);
        panel_ImgBloqueLayout.setHorizontalGroup(
            panel_ImgBloqueLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panel_ImgBloqueLayout.createSequentialGroup()
                .addComponent(props_ImgBloque)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        panel_ImgBloqueLayout.setVerticalGroup(
            panel_ImgBloqueLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panel_ImgBloqueLayout.createSequentialGroup()
                .addComponent(props_ImgBloque)
                .addGap(0, 124, Short.MAX_VALUE))
        );

        props_txtDesc.setColumns(18);
        props_txtDesc.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        props_txtDesc.setLineWrap(true);
        props_txtDesc.setRows(7);
        props_txtDesc.setWrapStyleWord(true);
        jScrollPane2.setViewportView(props_txtDesc);

        props_txtNombre.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N

        props_txtCodigo.setColumns(2);
        props_txtCodigo.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N

        props_txtCateg.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N

        props_btnSolido.setFont(new java.awt.Font("Calibri", 1, 12)); // NOI18N
        props_btnSolido.setText("Bloque Sólido");

        props_txtX.setColumns(10);
        props_txtX.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        props_txtX.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        props_txtY.setColumns(10);
        props_txtY.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        props_txtY.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        props_btnCambiar.setFont(new java.awt.Font("Calibri", 1, 12)); // NOI18N
        props_btnCambiar.setText("Cambiar");
        props_btnCambiar.setEnabled(false);

        lblCodigo.setFont(new java.awt.Font("Calibri", 1, 12)); // NOI18N
        lblCodigo.setText("Código:");

        jLabel1.setFont(new java.awt.Font("Calibri", 1, 12)); // NOI18N
        jLabel1.setText("Nombre:");

        jLabel2.setFont(new java.awt.Font("Calibri", 1, 12)); // NOI18N
        jLabel2.setText("Categoría:");

        jLabel3.setFont(new java.awt.Font("Calibri", 1, 12)); // NOI18N
        jLabel3.setText("Descripción:");

        jLabel4.setFont(new java.awt.Font("Calibri", 1, 12)); // NOI18N
        jLabel4.setText("Coordenadas:");

        lblCodigo1.setFont(new java.awt.Font("Calibri", 1, 12)); // NOI18N
        lblCodigo1.setText("X:");

        lblCodigo2.setFont(new java.awt.Font("Calibri", 1, 12)); // NOI18N
        lblCodigo2.setText("Y:");

        javax.swing.GroupLayout panelPropsLayout = new javax.swing.GroupLayout(panelProps);
        panelProps.setLayout(panelPropsLayout);
        panelPropsLayout.setHorizontalGroup(
            panelPropsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelPropsLayout.createSequentialGroup()
                .addGap(50, 50, 50)
                .addGroup(panelPropsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(props_btnCambiar, javax.swing.GroupLayout.DEFAULT_SIZE, 128, Short.MAX_VALUE)
                    .addComponent(panel_ImgBloque, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(0, 0, Short.MAX_VALUE))
            .addGroup(panelPropsLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelPropsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 208, Short.MAX_VALUE)
                    .addComponent(props_txtNombre)
                    .addGroup(panelPropsLayout.createSequentialGroup()
                        .addGroup(panelPropsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel3)
                            .addComponent(props_btnSolido)
                            .addGroup(panelPropsLayout.createSequentialGroup()
                                .addComponent(lblCodigo1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(props_txtX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jLabel4)
                            .addGroup(panelPropsLayout.createSequentialGroup()
                                .addComponent(lblCodigo2)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(props_txtY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jLabel1))
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(panelPropsLayout.createSequentialGroup()
                        .addGroup(panelPropsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2)
                            .addComponent(props_txtCateg, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 70, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
            .addGroup(panelPropsLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelPropsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblCodigo)
                    .addComponent(props_txtCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        panelPropsLayout.setVerticalGroup(
            panelPropsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelPropsLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panel_ImgBloque, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(props_btnCambiar)
                .addGap(18, 18, 18)
                .addComponent(lblCodigo)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(props_txtCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(props_txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(props_txtCateg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelPropsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(props_txtX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblCodigo1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelPropsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(props_txtY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblCodigo2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(props_btnSolido)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        panelEstado.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        javax.swing.GroupLayout panelEstadoLayout = new javax.swing.GroupLayout(panelEstado);
        panelEstado.setLayout(panelEstadoLayout);
        panelEstadoLayout.setHorizontalGroup(
            panelEstadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        panelEstadoLayout.setVerticalGroup(
            panelEstadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 25, Short.MAX_VALUE)
        );

        txtNombreMapa.setColumns(30);
        txtNombreMapa.setFont(new java.awt.Font("Calibri", 1, 18)); // NOI18N
        txtNombreMapa.setSelectedTextColor(new java.awt.Color(240, 240, 240));

        javax.swing.GroupLayout panelCabezeraLayout = new javax.swing.GroupLayout(panelCabezera);
        panelCabezera.setLayout(panelCabezeraLayout);
        panelCabezeraLayout.setHorizontalGroup(
            panelCabezeraLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelCabezeraLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(txtNombreMapa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(506, Short.MAX_VALUE))
        );
        panelCabezeraLayout.setVerticalGroup(
            panelCabezeraLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelCabezeraLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(txtNombreMapa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        panelHerram.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Herramientas", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Calibri", 1, 14), new java.awt.Color(0, 0, 0))); // NOI18N

        herram_btnPuntero.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        herram_btnPuntero.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recursos/img/cursor.png"))); // NOI18N
        herram_btnPuntero.setEnabled(false);
        herram_btnPuntero.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                herram_btnPunteroActionPerformed(evt);
            }
        });

        herram_btnLapiz.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        herram_btnLapiz.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recursos/img/lapiz.png"))); // NOI18N
        herram_btnLapiz.setEnabled(false);
        herram_btnLapiz.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                herram_btnLapizActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelHerramLayout = new javax.swing.GroupLayout(panelHerram);
        panelHerram.setLayout(panelHerramLayout);
        panelHerramLayout.setHorizontalGroup(
            panelHerramLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelHerramLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelHerramLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(herram_btnPuntero, javax.swing.GroupLayout.DEFAULT_SIZE, 76, Short.MAX_VALUE)
                    .addComponent(herram_btnLapiz, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        panelHerramLayout.setVerticalGroup(
            panelHerramLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelHerramLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(herram_btnPuntero)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(herram_btnLapiz)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        scroll_panelEditor.setMaximumSize(new java.awt.Dimension(952, 632));
        scroll_panelEditor.setPreferredSize(new java.awt.Dimension(952, 632));

        panel_editorMapa.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        panel_editorMapa.setOpaque(true);
        panel_editorMapa.setPreferredSize(new java.awt.Dimension(940, 620));

        javax.swing.GroupLayout panel_editorMapaLayout = new javax.swing.GroupLayout(panel_editorMapa);
        panel_editorMapa.setLayout(panel_editorMapaLayout);
        panel_editorMapaLayout.setHorizontalGroup(
            panel_editorMapaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 960, Short.MAX_VALUE)
        );
        panel_editorMapaLayout.setVerticalGroup(
            panel_editorMapaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 630, Short.MAX_VALUE)
        );

        scroll_panelEditor.setViewportView(panel_editorMapa);

        panelBloque.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Bloque", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Calibri", 1, 14))); // NOI18N

        bloque_btnSelec.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        bloque_btnSelec.setEnabled(false);
        bloque_btnSelec.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bloque_btnSelecActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelBloqueLayout = new javax.swing.GroupLayout(panelBloque);
        panelBloque.setLayout(panelBloqueLayout);
        panelBloqueLayout.setHorizontalGroup(
            panelBloqueLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelBloqueLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(bloque_btnSelec, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        panelBloqueLayout.setVerticalGroup(
            panelBloqueLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(bloque_btnSelec, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        barramenu.setBackground(new java.awt.Color(244, 244, 244));

        menuArchivo.setText("Archivo");
        menuArchivo.setFont(new java.awt.Font("Calibri", 1, 14)); // NOI18N

        mItemNuevo.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK));
        mItemNuevo.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        mItemNuevo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recursos/img/nuevo.png"))); // NOI18N
        mItemNuevo.setText("Nuevo Mapa");
        mItemNuevo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mItemNuevoActionPerformed(evt);
            }
        });
        menuArchivo.add(mItemNuevo);

        mItemAbrir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        mItemAbrir.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        mItemAbrir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recursos/img/abrir.png"))); // NOI18N
        mItemAbrir.setText("Abrir Mapa");
        mItemAbrir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mItemAbrirActionPerformed(evt);
            }
        });
        menuArchivo.add(mItemAbrir);
        menuArchivo.add(jSeparator2);

        mItemGuardar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
        mItemGuardar.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        mItemGuardar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recursos/img/guardar.png"))); // NOI18N
        mItemGuardar.setText("Guardar Mapa");
        mItemGuardar.setEnabled(false);
        mItemGuardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mItemGuardarActionPerformed(evt);
            }
        });
        menuArchivo.add(mItemGuardar);
        menuArchivo.add(jSeparator3);

        mItemCerrar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_W, java.awt.event.InputEvent.CTRL_MASK));
        mItemCerrar.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        mItemCerrar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recursos/img/cerrar.png"))); // NOI18N
        mItemCerrar.setText("Cerrar Mapa");
        mItemCerrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mItemCerrarActionPerformed(evt);
            }
        });
        menuArchivo.add(mItemCerrar);
        menuArchivo.add(jSeparator1);

        mItemSalir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q, java.awt.event.InputEvent.CTRL_MASK));
        mItemSalir.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        mItemSalir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recursos/img/salir.png"))); // NOI18N
        mItemSalir.setText("Salir");
        mItemSalir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mItemSalirActionPerformed(evt);
            }
        });
        menuArchivo.add(mItemSalir);

        barramenu.add(menuArchivo);

        setJMenuBar(barramenu);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(panelHerram, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(panelBloque, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(28, 28, 28)
                        .addComponent(scroll_panelEditor, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(panelCabezera, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addGap(18, 18, 18)
                .addComponent(panelProps, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .addComponent(panelEstado, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(panelProps, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(panelCabezera, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(scroll_panelEditor, javax.swing.GroupLayout.PREFERRED_SIZE, 632, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(panelHerram, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(panelBloque, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addGap(18, 18, 18)
                .addComponent(panelEstado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void mItemNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mItemNuevoActionPerformed
        dialogoNuevoMapa.setVisible(true);
    }//GEN-LAST:event_mItemNuevoActionPerformed

    private void nmapa_btnAceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nmapa_btnAceptarActionPerformed
        try {
            cm.NuevoMapa(nmapa_txtAutor.getText(), txtNombreMapa.getText(), nmapa_txtDesc.getText(), Integer.parseInt(nmapa_txtTamBloques.getText()), Integer.parseInt(nmapa_txtColumnas.getText()), Integer.parseInt(nmapa_txtFilas.getText()), new Date());
            panel_editorMapa.setPreferredSize(new Dimension(cm.getPanelTamanioX(), cm.getPanelTamanioY()));
            dialogoNuevoMapa.setVisible(false);
            panel_editorMapa.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            ActivarHerramientas();
        } catch (NumberFormatException e) {
            JOptionPane.showMessageDialog(this, "Solo está permitido números en filas y columnas", "Error", JOptionPane.ERROR_MESSAGE);
        }

    }//GEN-LAST:event_nmapa_btnAceptarActionPerformed

    private void nmapa_btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nmapa_btnCancelarActionPerformed
        dialogoNuevoMapa.setVisible(false);
    }//GEN-LAST:event_nmapa_btnCancelarActionPerformed

    private void mItemSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mItemSalirActionPerformed
        int opcion = JOptionPane.showConfirmDialog(this, "¿Está seguro que desea salir? Los cambios no guardados se perderán", "Salir", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
        if (opcion == JOptionPane.YES_OPTION) {
            System.exit(1);
        }
    }//GEN-LAST:event_mItemSalirActionPerformed

    private void herram_btnPunteroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_herram_btnPunteroActionPerformed
        herram_btnPuntero.setSelected(true);
        herram_btnLapiz.setSelected(false);
        panel_editorMapa.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    }//GEN-LAST:event_herram_btnPunteroActionPerformed

    private void herram_btnLapizActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_herram_btnLapizActionPerformed
        herram_btnLapiz.setSelected(true);
        herram_btnPuntero.setSelected(false);
        panel_editorMapa.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
    }//GEN-LAST:event_herram_btnLapizActionPerformed

    private void bloque_btnSelecActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bloque_btnSelecActionPerformed
        ce.SeleccionarBloque();
        dialogoSelecBloque.setLocationRelativeTo(this);
        dialogoSelecBloque.setVisible(true);
    }//GEN-LAST:event_bloque_btnSelecActionPerformed

    private void selecB_btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_selecB_btnCancelarActionPerformed
        dialogoSelecBloque.setVisible(false);
    }//GEN-LAST:event_selecB_btnCancelarActionPerformed

    private void selecB_btnSelecActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_selecB_btnSelecActionPerformed
        Image bloqueIcon64 = btnSelectBloque_Icon.getScaledInstance(bloque_btnSelec.getSize().width, bloque_btnSelec.getSize().height, Image.SCALE_SMOOTH);
        ce.setBtnSelectBloque_Icon(bloqueIcon64);
        bloque_btnSelec.setIcon(new ImageIcon(bloqueIcon64));
        dialogoSelecBloque.setVisible(false);
    }//GEN-LAST:event_selecB_btnSelecActionPerformed

    private void mItemGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mItemGuardarActionPerformed
        int userSelection = 0;
        nombreMapa = txtNombreMapa.getText();
        dialogoGuardarArchivo.setSelectedFile(new File(nombreMapa));
        userSelection = dialogoGuardarArchivo.showSaveDialog(this);
        try {
            if (userSelection == JFileChooser.APPROVE_OPTION) {
                cm.GuardarMapa(new File(nombreMapa), dialogoGuardarArchivo.getCurrentDirectory().toPath());
                JOptionPane.showMessageDialog(this, "Archivo guardado corréctamente", "Guardar Mapa", JOptionPane.INFORMATION_MESSAGE);
            }
        } catch (Exception e) {
            JOptionPane.showMessageDialog(this, "Error al guardar el Archivo", "Guardar Mapa", JOptionPane.ERROR_MESSAGE);
        }

    }//GEN-LAST:event_mItemGuardarActionPerformed

    private void mItemCerrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mItemCerrarActionPerformed
        mItemGuardar.setEnabled(false);
        cm.CerrarMapa();
        LimpiarComponentes();
    }//GEN-LAST:event_mItemCerrarActionPerformed

    private void mItemAbrirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mItemAbrirActionPerformed
        int userSelection = 0;
        filtro = new FileNameExtensionFilter("Mapa de MapBuilder", "map");
        dialogoGuardarArchivo.setFileFilter(filtro);
        userSelection = dialogoGuardarArchivo.showOpenDialog(this);
        if (userSelection == JFileChooser.APPROVE_OPTION) {
            if (cm.AbrirMapa(dialogoGuardarArchivo.getSelectedFile())) {
                ActivarHerramientas();
                txtNombreMapa.setText(cm.getNombreMapa());
            } else {
                JOptionPane.showMessageDialog(this, "Error al leer el archivo de mapa", "ERROR", JOptionPane.ERROR_MESSAGE);
            }

        }

    }//GEN-LAST:event_mItemAbrirActionPerformed

    private void nmapa_btnIdentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nmapa_btnIdentActionPerformed
        cu = new ControladorUsuario();
        dialogoIdentificarse.setVisible(true);
    }//GEN-LAST:event_nmapa_btnIdentActionPerformed

    private void dialogoBtnIdentificarseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dialogoBtnIdentificarseActionPerformed
        if (cu.Identificarse(txtUsuario.getText(), txtClave.getText())) {
            nmapa_txtAutor.setText(cu.getNombreUsuario());
            dialogoIdentificarse.setVisible(false);
            txtUsuario.setText("");
            txtClave.setText("");
        } else {
            JOptionPane.showMessageDialog(this, "Usuario o clave incorrecta", "Error al identificarse", JOptionPane.ERROR_MESSAGE);
        }
    }//GEN-LAST:event_dialogoBtnIdentificarseActionPerformed

    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;

                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(VentanaMapBuilder.class
                    .getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(VentanaMapBuilder.class
                    .getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(VentanaMapBuilder.class
                    .getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(VentanaMapBuilder.class
                    .getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new VentanaMapBuilder().setVisible(true);
            }
        });
    }

    // <editor-fold desc="Getters" defaultstate="collapsed">
    public JPanel getPanelSelecBloque() {
        return panelSelecBloque;
    }

    public JButton getBloque_btnSelec() {
        return bloque_btnSelec;
    }

    public ControladorHerramientas getCe() {
        return ce;
    }

    public ControladorMapa getCm() {
        return cm;
    }

    public ControladorUsuario getCu() {
        return cu;
    }

    public Bloque getBloqueSeleccionado() {
        return bloqueSeleccionado;
    }

    public JDialog getDialogoCargando() {
        return dialogoCargando;
    }

    public JLabel getLabelCargando() {
        return labelCargando;
    }

    public List<ElementoMapa> getElementosMapa() {
        return elementosMapa;
    }

    public JToggleButton getHerram_btnLapiz() {
        return herram_btnLapiz;
    }

    public JToggleButton getHerram_btnPuntero() {
        return herram_btnPuntero;
    }

    public JTextField getNmapa_txtAutor() {
        return nmapa_txtAutor;
    }

    public JTextField getNmapa_txtColumnas() {
        return nmapa_txtColumnas;
    }

    public JTextArea getNmapa_txtDesc() {
        return nmapa_txtDesc;
    }

    public JTextField getNmapa_txtFilas() {
        return nmapa_txtFilas;
    }

    public JTextField getNmapa_txtNombre() {
        return nmapa_txtNombre;
    }

    public JTextField getNmapa_txtTamBloques() {
        return nmapa_txtTamBloques;
    }

    public JLabel getProps_ImgBloque() {
        return props_ImgBloque;
    }

    public JButton getProps_btnCambiar() {
        return props_btnCambiar;
    }

    public JToggleButton getProps_btnSolido() {
        return props_btnSolido;
    }

    public JTextField getProps_txtCateg() {
        return props_txtCateg;
    }

    public JTextField getProps_txtCodigo() {
        return props_txtCodigo;
    }

    public JTextArea getProps_txtDesc() {
        return props_txtDesc;
    }

    public JTextField getProps_txtNombre() {
        return props_txtNombre;
    }

    public JTextField getProps_txtX() {
        return props_txtX;
    }

    public JTextField getProps_txtY() {
        return props_txtY;
    }

    public JLabel getSelecB_ImgBloque() {
        return selecB_ImgBloque;
    }

    public JButton getSelecB_btnCancelar() {
        return selecB_btnCancelar;
    }

    public JButton getSelecB_btnSelec() {
        return selecB_btnSelec;
    }

    public JTextField getSelecB_txtCateg() {
        return selecB_txtCateg;
    }

    public JTextArea getSelecB_txtDesc() {
        return selecB_txtDesc;
    }

    public JTextField getSelecB_txtNombre() {
        return selecB_txtNombre;
    }

    public JTextField getTxtNombreMapa() {
        return txtNombreMapa;
    }

    public Image getBtnSelectBloque_Icon() {
        return btnSelectBloque_Icon;
    }

    public void setBtnSelectBloque_Icon(Image btnSelectBloque_Icon) {
        this.btnSelectBloque_Icon = btnSelectBloque_Icon;
    }

    public JLayeredPane getPanel_editorMapa() {
        return panel_editorMapa;
    } // </editor-fold>

    // <editor-fold desc="Declaración de variables" defaultstate="collapsed">
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuBar barramenu;
    private javax.swing.JButton bloque_btnSelec;
    private javax.swing.JButton dialogoBtnIdentificarse;
    private javax.swing.JDialog dialogoCargando;
    private javax.swing.JFileChooser dialogoGuardarArchivo;
    private javax.swing.JDialog dialogoIdentificarse;
    private javax.swing.JDialog dialogoNuevoMapa;
    private javax.swing.JDialog dialogoSelecBloque;
    private javax.swing.JToggleButton herram_btnLapiz;
    private javax.swing.JToggleButton herram_btnPuntero;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JPopupMenu.Separator jSeparator2;
    private javax.swing.JPopupMenu.Separator jSeparator3;
    private javax.swing.JLabel labelCargando;
    private javax.swing.JLabel lblCodigo;
    private javax.swing.JLabel lblCodigo1;
    private javax.swing.JLabel lblCodigo2;
    private javax.swing.JMenuItem mItemAbrir;
    private javax.swing.JMenuItem mItemCerrar;
    private javax.swing.JMenuItem mItemGuardar;
    private javax.swing.JMenuItem mItemNuevo;
    private javax.swing.JMenuItem mItemSalir;
    private javax.swing.JMenu menuArchivo;
    private javax.swing.JButton nmapa_btnAceptar;
    private javax.swing.JButton nmapa_btnCancelar;
    private javax.swing.JButton nmapa_btnIdent;
    private javax.swing.JTextField nmapa_txtAutor;
    private javax.swing.JTextField nmapa_txtColumnas;
    private javax.swing.JTextArea nmapa_txtDesc;
    private javax.swing.JTextField nmapa_txtFilas;
    private javax.swing.JTextField nmapa_txtNombre;
    private javax.swing.JTextField nmapa_txtTamBloques;
    private javax.swing.JPanel panelBloque;
    private javax.swing.JPanel panelCabezera;
    private javax.swing.JPanel panelEstado;
    private javax.swing.JPanel panelHerram;
    private javax.swing.JPanel panelProps;
    private javax.swing.JPanel panelSelecBloque;
    private javax.swing.JPanel panel_ImgBloque;
    private javax.swing.JPanel panel_ImgSelecBloque;
    private javax.swing.JLayeredPane panel_editorMapa;
    private javax.swing.JPanel panel_nuevoMapa;
    private javax.swing.JLabel props_ImgBloque;
    private javax.swing.JButton props_btnCambiar;
    private javax.swing.JToggleButton props_btnSolido;
    private javax.swing.JTextField props_txtCateg;
    private javax.swing.JTextField props_txtCodigo;
    private javax.swing.JTextArea props_txtDesc;
    private javax.swing.JTextField props_txtNombre;
    private javax.swing.JTextField props_txtX;
    private javax.swing.JTextField props_txtY;
    private javax.swing.JScrollPane scroll_SelectBloque;
    private javax.swing.JScrollPane scroll_panelEditor;
    private javax.swing.JLabel selecB_ImgBloque;
    private javax.swing.JButton selecB_btnCancelar;
    private javax.swing.JButton selecB_btnSelec;
    private javax.swing.JTextField selecB_txtCateg;
    private javax.swing.JTextArea selecB_txtDesc;
    private javax.swing.JTextField selecB_txtNombre;
    private javax.swing.JPasswordField txtClave;
    private javax.swing.JTextField txtNombreMapa;
    private javax.swing.JTextField txtUsuario;
    // End of variables declaration//GEN-END:variables
    // </editor-fold>
}
